package edu.ccut.saturn.basecomponent.database.impl.sqlserver.builder.unused;

import edu.ccut.saturn.basecomponent.database.ISaturnSQL;
import edu.ccut.saturn.basecomponent.database.SaturnSQLBuilderFactory;
import edu.ccut.saturn.basecomponent.database.impl.AbstractInsertSQLBuilder;
import edu.ccut.saturn.component.IDataItem;
/**
 *不包括主键不包括大数据的简单实现
 * @author tony
 *
 */

public class OracleInsertSQLBuilder extends AbstractInsertSQLBuilder {

	@Override
	protected String getDatabaseType() {
		return SaturnSQLBuilderFactory.ORACLE;
	}
	
	@Override
	public String getColumnValueString(IDataItem iDataItem, Object value) {
		String type = iDataItem.getType();
		if ("DATE".equals(type)) {
			return"to_date(?, 'yyyy-mm-dd hh24:mi:ss'),";
		}
		return "?,"; 
	}

	@Override
	protected String getOperationType() {
		return ISaturnSQL.INSERT_OPERATION;
	}
	
	@Override
	protected String getPrimerKeySql(IDataItem dataItem) {
		return "select " + dataItem.getSequenceName() + ".nextval as primaryKey FROM dual";
	}
}
